import { lazy } from "react";
import { Navigate, type RouteObject } from "react-router-dom";
import RouterAuth from "./RouterAuth";

const LoginPage = lazy(() => import("../views/LoginPage"));
const HomePage = lazy(() => import("../views/HomePage"));
const IndexPage = lazy(() => import("../views/IndexPage"));
const PatientPage = lazy(() => import("../views/WorkPlace/Patient"));
const ArticlePage = lazy(() => import("../views/media/Artice"));
const VideoPage = lazy(() => import("../views/media/Video"));
const ProgrammePage = lazy(() => import("@/views/InforManage/Programme"));
const AiChartPage = lazy(() => import("@/views/AiChart"));
import LeaveWordPage from "../views/WorkPlace/LeaveWord";

const TaskModificationById = lazy(
  () => import("../views/WorkPlace/Patient/TaskModificationById")
);

const routes: RouteObject[] = [
  {
    path: "/",
    element: <Navigate to="/login" />,
  },
  {
    path: "/login",
    element: <LoginPage />,
  },

  {
    path: "/home",
    element: (
      <RouterAuth>
        <HomePage />
      </RouterAuth>
    ),
    children: [
      {
        index: true,
        element: <Navigate to="index" />,
      },
      {
        path: "index",
        element: <IndexPage />,
      },
      {
        path: "workplace/patient",
        element: <PatientPage />,
      },
      {
        path: "workplace/taskExamination/:id",
        element: <TaskModificationById />,
      },
      {
        path: "workplace/leaveword",
        element: <LeaveWordPage />,
      },
      {
        path: "media/article",
        element: <ArticlePage />,
      },
      {
        path: "media/video",
        element: <VideoPage />,
      },
      {
        path: "inforManage/programme",
        element: <ProgrammePage />,
      },
      {
        path: "inforManage/aichart",
        element: <AiChartPage />,
      },
    ],
  },
];
export default routes;
